<!doctype html>
<html>
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width,initial-scale=1.0,user-scalable=no">
<meta name="apple-mobile-web-app-capable" content="yes">
<meta name="apple-mobile-web-app-status-bar-style" content="black-translucent">
<meta name="format-detection" content="telephone=no">
    #parse("/h5/common/webWords.html")
<link rel="stylesheet" type="text/css" href="http://${staticHost}/css/medioadaption.css">
<link rel="stylesheet" type="text/css" href="http://${staticHost}/css/stcss.css">
<script type="text/javascript" src="http://${staticHost}/js/jquery.js"></script>
<script type="text/javascript" src="http://${staticHost}/js/continuingEducation.js"></script>
<script type="text/javascript" src="http://${staticHost}/js/ajaxFileUpload.js"></script>
	<link rel="stylesheet" type="text/css" href="http://${staticHost}/css/style1.css" />
#parse("/h5/common/datetime.html")
	<!--头部 begin -->
    #parse("/h5/common/headerTop.html")
    <!--头部 end -->
    <!--登出系统 begin-->
    #parse("/h5/common/loginHeader.html")
    <!--登出系统 end-->
    <style type="text/css">
    	.editMood{
            color: #333;
        }
         .current a {
             font-size: 20px;
         }
 
         .over {
             display: none;
             position: absolute;
             top: 1300px;
             left: 0;
             width: 100%;
             height: 800px;
             background-color: #f5f5f5;
             opacity:0.5;
             z-index: 1000;
         }

        .layout {
            display: none;
            position: absolute;
            top: 1500px;
            left: 40%;
            width: 20%;
            height: 20%;
            z-index: 1001;
            text-align:center;
        }
        
        .myForm li{
        	border-bottom:1px #ddd dashed;
        }
        
        .div1{
        	font-size: 16px; 
        	color:#666;
        }
        .login-box input{padding:0;font-size:14px;height: 30px; line-height:30px;}
        .datetime{width: 28%;  }
        .schoolwork{width: 30%;margin-left:2%;}
        .single {font-size: 14px;}
        .resumetextarea{    margin: 15px 5px;width: 95%;padding-left: 2px;padding-top: 2px;font-size: 14px;}

		.jobtitle1{
			font-size: 18px;
            height: 50px;
            line-height: 50px;
			color: #333333;
			background-color: #fefeff;
			border-bottom: 1px solid #f8f7fc;
		}

    </style>
</head>


<body style="background: white;">
#parse("/h5/common/back.html")
<div align="center" class="jobtitle1">完善个人信息</div>
<div class="login-box">
    <div class="login-box-width">
    	<form id="myForm" action="" class="myForm">
            <ul>
                <li>
                	<div class="title div1" align="center">学习经历</div>
                	#if($learningList)
                		#foreach($learning in $learningList)
                			<div style="margin-top: 15px;" class="learningDiv" >
			                    <input type="text" class="datetime" id="$learning.startId" placeholder="起始日期" value="$learning.learnStartDate">
			                	<span class="single">至</span>
			                	<input type="text" class="datetime" id="$learning.endId" placeholder="结束日期"  value="$learning.learnEndDate">
			                	<input type="text" class="schoolwork" id="school" placeholder="毕业院校"  value="$learning.school">
	                    	</div>
                		#end
                		<div class="title" align="center" style="margin: 15px 5px; font-size: 13px; color: #0f7bdd;" id="learningExperience" count='$learningCount'>添加学习经历</div>
                	#else
	                    <div style="margin-top: 15px;" class="learningDiv" >
		                    <input type="text" class="datetime" id="learnStartDate1" placeholder="起始日期" >
		                	<span class="single">至</span>
		                	<input type="text" class="datetime" id="learnEndDate1" placeholder="结束日期" >
		                	<input type="text" class="schoolwork" id="school" placeholder="毕业院校" >
	                    </div>
	                    <div class="title" align="center" style="margin: 15px 5px; font-size: 13px; color: #0f7bdd;" id="learningExperience" count=1>添加学习经历</div>
                    #end
                    
                    
                </li>
                <li>
                <div class="title div1" align="center" >工作经历</div>
                #if($workList)
                	#foreach($work in $workList)
	                	<div style="margin-top: 15px;" class="workDiv">
		                    <input type="text" class="datetime" id='$work.startId' placeholder="起始日期"  value="$work.workStartDate">
		                	<span class="single">至</span>
		                	<input type="text" class="datetime" id='$work.endId' placeholder="结束日期"  value="$work.workEndDate">
		                	<input type="text" class="schoolwork" id=working placeholder="工作单位"  value="$work.working">
	                    </div>
                	#end
                	<div class="title" align="center" style="margin: 15px 5px; font-size: 13px; color: #0f7bdd;" id="workExperience" count='$workCount'>添加工作经历</div>
                #else
                	<div style="margin-top: 15px;" class="workDiv">
	                    <input type="text" class="datetime" id=workStartDate1 placeholder="起始日期" >
	                	<span class="single">至</span>
	                	<input type="text" class="datetime" id=workEndDate1 placeholder="结束日期" >
	                	<input type="text" class="schoolwork" id=working placeholder="工作单位" >
                    </div>
                    <div class="title" align="center" style="margin: 15px 5px; font-size: 13px; color: #0f7bdd;" id="workExperience" count=1>添加工作经历</div>
                #end
                    
                </li>
                <li>
                	<div class="title div1" align="center">个人特长</div>
                	<div style="margin-top: 5px;">
                    	<textarea class="resumetextarea" placeholder="个人特长" id="personalSpecialty" rows="3" >$!userMap.personalSpecialty</textarea>
                    </div>
                </li>
                <li>
	                <div class="title div1" align="center">对招聘公司的详细要求</div>
	                <div style="margin-top: 5px;">
	                	<textarea class="resumetextarea" placeholder="对招聘公司的详细要求" id="jobRequirements" rows="3"  >$!userMap.jobRequirements</textarea>
	                </div>
                </li>
                <li>
	                <div class="title div1" align="center">自我介绍</div>
	                <div style="margin-top: 5px;">
	                	<textarea class="resumetextarea" placeholder="自我介绍" id="selfIntroduction" rows="3"  >$!userMap.selfIntroduction</textarea>
	                </div>
                </li>
                <input type="hidden" id="userJobBasisSeeker" value="${userJobBasisSeeker}">
                <input type="hidden" id="userJobSeeker" value="$!{jobId}" />
            </ul>
        </form>
    </div>
    <div class="md_dl"><input name="" id="submitForm" class="global-button-big" status="1" type="button" value=" 提 交 " style="width:290px; font-size: 16px; height:42px;color: white; border:none; margin-top:20px; margin-bottom:30px;" /></div>
</div>
<div class="holderdiv"></div>
<div class="fixdiv">
  <ul>               
    <li>
    	#if($ssi.universityFillStatus == 1 && $ssi.baseInfoFillStatus == 1 && $ssi.workExperienceFillStatus == 1 && $ssi.familyFillStatus == 1)
    		<a href="/internal/auth/myClass">
    	#else
    		<a href="javascript:void(0)" onclick="window.history.go(-1)">
    	#end
    	<img src="http://${staticHost}/images/foticon001.jpg"><span>返回</span></a></li>
    <li><a href="/edu/auth/modifyPwd"><img src="http://${staticHost}/images/foticon004.jpg"><span>重置密码</span></a></li>
	<li><a href="javascript:void(0)" onclick="loginOut()"><img src="http://${staticHost}/images/foticon003.jpg"><span>退出系统</span></a></li>
  </ul>
</div>
<script src="http://${staticHost}/js/layer.js"></script>
<script type="text/javascript">
    function showMessage(msg){
        layer.open({
            content: msg
            ,btn: '关闭'
        });
    }
    $(document).ready(function(){
    	var currYear = (new Date()).getFullYear();	
    	var opt={};
    	opt.date = {preset : 'date'};
    	opt.datetime = {preset : 'datetime'};
    	opt.time = {preset : 'time'};
    	opt.default = {
    		theme: 'android-ics light', //皮肤样式
    		display: 'modal', //显示方式 
    		mode: 'scroller', //日期选择模式
    		dateFormat: 'yyyy-mm-dd',
    		lang: 'zh',
    		showNow: true,
    		nowText: "今天",
    		startYear: currYear - 50, //开始年份
    		endYear: currYear + 10 //结束年份
    	};
    	
    	$("#learnStartDate1").mobiscroll($.extend(opt['date'], opt['default']));
    	$("#learnEndDate1").mobiscroll($.extend(opt['date'], opt['default']));
    	$("#workStartDate1").mobiscroll($.extend(opt['date'], opt['default']));
    	$("#workEndDate1").mobiscroll($.extend(opt['date'], opt['default']));    	
    	
        $("#submitForm").click(function(){
        	var learnArr = [];
        	var a = 1;
        	var learningstatus = true;
        	$(".learningDiv").each(function(){
        		var _this = $(this);
        		var learnStartDate = _this.find("#learnStartDate"+a).val();
        		var learnEndDate = _this.find("#learnEndDate"+a).val();
        		if(learnStartDate > learnEndDate){
        			learningstatus = false;
        		}
        		var school = _this.find("#school").val();
        		var _temp = {};
        		if(learnStartDate != '' || learnEndDate != '' || school != ''){
                    _temp.learnStartDate = learnStartDate;
                    _temp.learnEndDate = learnEndDate;
                    _temp.school = school;
        			learnArr.push(_temp)
        		}
        		a++;
        	});
        	if(!learningstatus){
                showMessage("起始时间不能大于结束时间");
        		return false;
    		}
        	var workArr = [];
        	var b = 1;
        	var workstatus = true;
        	$(".workDiv").each(function(){
        		var _this = $(this);
        		var workStartDate = _this.find("#workStartDate"+b).val();
        		var workEndDate = _this.find("#workEndDate"+b).val();
        		if(workStartDate > workEndDate){
        			workstatus = false;
        		}
        		
        		var working = _this.find("#working").val();
                var _temp = {};
        		if(workStartDate != '' || workEndDate != '' || working != ''){
                    _temp.workStartDate = workStartDate;
                    _temp.workEndDate = workEndDate;
                    _temp.working = working;
        			workArr.push(_temp)
        		}
        		b++;
        		
        	});
        	if(!workstatus){
                showMessage("起始时间不能大于结束时间");
    			return false;
    		}
            if($(this).attr("status") == 2){
                return false;
            }

            var learningExperience = JSON.stringify(learnArr);
            var workingExperience = JSON.stringify(workArr);
            var personalSpecialty = $("#personalSpecialty").val();
            var jobRequirements = $("#jobRequirements").val();
            var selfIntroduction = $("#selfIntroduction").val();

        	if(learnArr.length<=0){
                showMessage("请填写学习经历！");
                return false;
			}
            if(workArr.length<=0){
                showMessage("请填写工作经历！");
                return false;
            }
            if(personalSpecialty.length<=0){
                showMessage("请填写个人特长！");
                return false;
            }
            if(jobRequirements.length<=0){
                showMessage("请填写对招聘公司详细要求！");
                return false;
            }
            if(selfIntroduction.length<=0){
                showMessage("请填写自我介绍！");
                return false;
            }
            $(this).attr("status",2);
            var userJobBasisSeeker = $("#userJobBasisSeeker").val();
            var userJobSeeker = $("#userJobSeeker").val();
            var resumeId = "$!{resumeId}"
        	$.ajax({
                url:"/personnelWork/auth/resume",
                data:{
                    learningExperience:learningExperience,
                    workingExperience:workingExperience,
                    personalSpecialty:personalSpecialty,
                    jobRequirements:jobRequirements,
                    userJobBasisSeeker:userJobBasisSeeker,
                    userJobSeeker:userJobSeeker,
                    selfIntroduction:selfIntroduction,
					resumeId:resumeId

                }, // 从表单中获取数据
                type:"POST", 
                error:function(xmlHttpRequest, error) { // 设置表单提交出错
                	console.log(error);
                },
                success:function(resData) {
                	if(resData.status == '00000000'){
                		showMessage("保存成功");
                		var indexFlag = resData.result.indexFlag;
                		if(indexFlag == "1"){
                            window.location.href="/personnelWork/auth/applyJob";
						}else{
                            window.location.href="/personnelWork/auth/myResume?jobId="+userJobSeeker;
                        }
                	}else{
                        showMessage(resData.message);
                	}
                }
            });
        });
        
        $("#learningExperience").click(function(){
        	var _this = $(this);
        	var count = _this.attr('count');
        	if(count == 1){
        		if($("#learnStartDate1").val()=='' || $("#learnEndDate1").val()=='' || $("#learnEndDate1").next().val() ==''){
                    showMessage('请填写完整当前的，再添加学习经历');
            		return ;
        		}
        	}
        	if(count == 2){
        		if($("#learnStartDate2").val()=='' || $("#learnEndDate2").val()=='' || $("#learnEndDate2").next().val() ==''){
                    showMessage('请填写完整当前的，再添加学习经历');
            		return ;
        		}
        	}
        	if(count == 3){
                showMessage('学习经历,最多可填写最近3次');
        		return ;
        	}
        	count = parseInt(count) + 1; 
        	_this.attr('count', count);
        	var html ="<div style=\"margin-top: 5px;\" class=learningDiv><input type=text class='datetime' id=learnStartDate"+count+" placeholder=起始日期 > <span class='single'>至</span> <input class='datetime' type=text id=learnEndDate"+count+" placeholder=结束日期  > <input class='schoolwork' type=text id=school placeholder=毕业院校  ></div>"
        	$("#learningExperience").before(html);
        	$("#learnStartDate"+count).mobiscroll($.extend(opt['date'], opt['default']));
        	$("#learnEndDate"+count).mobiscroll($.extend(opt['date'], opt['default']));
        });
        
        $("#workExperience").click(function(){
        	var _this = $(this);
        	var count = _this.attr('count');
        	if(count == 1){
        		if($("#workStartDate1").val()=='' || $("#workEndDate1").val()=='' || $("#workEndDate1").next().val() ==''){
                    showMessage('请填写当前的，再添加工作经历');
            		return ;
        		}
        	}
        	if(count == 2){
        		if($("#workStartDate2").val()=='' || $("#workEndDate2").val()=='' || $("#workEndDate2").next().val() ==''){
                    showMessage('请填写当前的，再添加工作经历');
            		return ;
        		}
        	}
        	if(count == 3){
                showMessage('工作经历,最多可填写最近3次');
        		return ;
        	}
        	count = parseInt(count) + 1; 
        	_this.attr('count', count);
        	var html ="<div style=\"margin-top: 5px;\" class=workDiv><input type=text id=workStartDate"+count+" placeholder=起始日期  class='datetime'> <span class='single'>至</span> <input type=text id=workEndDate"+count+" placeholder=结束日期  class='datetime'> <input type=text id=working placeholder=工作单位  class='schoolwork'></div>"
        	$("#workExperience").before(html);
        	$("#workStartDate"+count).mobiscroll($.extend(opt['date'], opt['default']));
        	$("#workEndDate"+count).mobiscroll($.extend(opt['date'], opt['default']));
        });
    });
    
    function showLoading(){
	    document.getElementById("over").style.display = "block";
	    document.getElementById("layout").style.display = "block";
	}
	
	function hideLoading(){
	    document.getElementById("over").style.display = "none";
	    document.getElementById("layout").style.display = "none";
	}
	

    
</script>
 
</body>
</html>
